var t = getApp();

Page({
    data: {
        teamId: "",
        content: "",
        level: ""
    },
    saveData: function() {
        var n = this;
        t.network.post({
            url: t.url.addEchelon,
            params: {
                teamId: n.data.teamId,
                name: n.data.content,
                level: n.data.level
            },
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(n) {
                t.util.showToast(n.data.message), 1 == n.data.result && setTimeout(function() {
                    wx.navigateBack({});
                }, 1200);
            },
            fail: function() {
                t.util.showToast("加载失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
            }
        });
    },
    inputChange: function(t, n) {
        this.setData({
            content: t.detail.content
        });
    },
    clickSave: function(n) {
        0 != this.data.content.length ? this.saveData() : t.util.showToast("请输入梯队名");
    },
    onLoad: function(t) {
        this.setData({
            teamId: t.teamId,
            level: t.level
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});